package com.mew.slots.util.util;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 * @author dylin
 * @create 2021/4/19
 */
public class ClazzsGetUtil {
    public static List<String> getClassName(String packageName) {
        List<String> classNames = new ArrayList<>();
        String packagePath = packageName.replace(".", "/");
        URL url = Thread.currentThread().getContextClassLoader().getResource(packagePath);
        if (url != null) {
            File df=new File(url.getPath());
            if(df.exists()&&df.isDirectory()){
                File[] games=df.listFiles();
                for (File game : games) {
                    if(game.isDirectory()){
                        classNames.add(game.getName());
                    }
                }
            }
        }

        return classNames;
    }
}
